// ==========================================================================
// GFast自动生成controller操作代码。
// 生成日期：2024-11-12 18:34:15
// 生成路径: internal/app/system/controller/order_types.go
// 生成人：zhou
// desc:订单类型
// company:云南奇讯科技有限公司
// ==========================================================================

package controller

import (
	"context"

	"github.com/tiger1103/gfast/v3/api/v1/system"
	"github.com/tiger1103/gfast/v3/internal/app/system/service"
)

type orderTypesController struct {
	BaseController
}

var OrderTypes = new(orderTypesController)

// List 列表
func (c *orderTypesController) List(ctx context.Context, req *system.OrderTypesSearchReq) (res *system.OrderTypesSearchRes, err error) {
	res = new(system.OrderTypesSearchRes)
	res.OrderTypesSearchRes, err = service.OrderTypes().List(ctx, &req.OrderTypesSearchReq)
	return
}

// Get 获取订单类型
func (c *orderTypesController) Get(ctx context.Context, req *system.OrderTypesGetReq) (res *system.OrderTypesGetRes, err error) {
	res = new(system.OrderTypesGetRes)
	res.OrderTypesInfoRes, err = service.OrderTypes().GetById(ctx, req.Id)
	return
}

// Add 添加订单类型
func (c *orderTypesController) Add(ctx context.Context, req *system.OrderTypesAddReq) (res *system.OrderTypesAddRes, err error) {
	err = service.OrderTypes().Add(ctx, req.OrderTypesAddReq)
	return
}

// Edit 修改订单类型
func (c *orderTypesController) Edit(ctx context.Context, req *system.OrderTypesEditReq) (res *system.OrderTypesEditRes, err error) {
	err = service.OrderTypes().Edit(ctx, req.OrderTypesEditReq)
	return
}

// Delete 删除订单类型
func (c *orderTypesController) Delete(ctx context.Context, req *system.OrderTypesDeleteReq) (res *system.OrderTypesDeleteRes, err error) {
	err = service.OrderTypes().Delete(ctx, req.Ids)
	return
}
